local kl__duzheng = fk.CreateSkill {
  name = "kl__duzheng",
}


kl__duzheng:addEffect("viewas", {
  pattern = "jink,peach,nullification",
  prompt = "#kl__duzheng",
  interaction = function(self, player)
    local all_names = {"jink","peach","nullification"}
    local names = player:getViewAsCardNames(kl__duzheng.name, all_names)
    if #names == 0 then return end
    return UI.CardNameBox {choices = names, all_names = all_names}
  end,
  card_filter = Util.FalseFunc,
  view_as = function(self, player, cards)
    if self.interaction.data == nil then return end
    local card = Fk:cloneCard(self.interaction.data)
    card.skillName = kl__duzheng.name
    return card
  end,
  before_use = function(self, player, use)
    local room = player.room
    if #room:askToDiscard(player, {
      min_num = 1,
      max_num = 1,
      skill_name = kl__duzheng.name,
      cancelable = true,
      include_equip = true,
    }) ~= 0 then
      player:turnOver()
    else
      return kl__duzheng.name
    end
  end,
  enabled_at_play = function(self, player)
    return not player.faceup
  end,
  enabled_at_response = function(self, player)
    return not player.faceup
  end,
})

return kl__duzheng
